package com.xuetang9.fujian.net.reponse;

import com.xuetang9.fujian.net.client.Client;
import com.xuetang9.fujian.view.WindowManager;

import javax.swing.*;
import java.util.HashMap;

/**
 * @describe:
 * @author:fujian
 * @date:2021/6/13
 * @Version: V1.0
 * @Package: com.xuetang9.fujian.net.reponse
 */
@SuppressWarnings("all")
public class RegisterResponseHandler extends AbstractResponseHandler{
    @Override
    public void handleRequest(HashMap<String, Object> message, Client client) {
        boolean success = (boolean) message.get("success");
        if (success){
            // registe success
            WindowManager.getRegisterFrame().dispose();
            String  userAccount = message.get("userAccount").toString();
            JOptionPane.showMessageDialog(null,"恭喜您注册的账号为：" + userAccount,"注册成功",JOptionPane.INFORMATION_MESSAGE);
            WindowManager.addRegisterFrame(null);
            WindowManager.getLoginFrame().setVisible(true);
        }
    }
}
